<?php

class Application_Form_Contact extends Application_Form_InlineForm {
    
    
    public function init() {
			
			 $this->setAttrib('id', 'formcontact');
			 
			 //Nom
            $nom = new Zend_Form_Element_Text('nom', array(
         		 'label' => 'Nom : ',
				 'required' => true,
            	 'filters' => array('StringTrim'),
            	 'validators' => array(
               		array('NotEmpty', true),
             		),
            	 'decorators' => $this->getElementDecorators(),
            	 'class' => 'pie'	
             ));
			
            $NomPropreValidator = new Validator_NomPropre();
            $nom->addValidator($NomPropreValidator, true);
			
			$description = new Zend_Form_Element_Textarea('description', array(
					'label' => 'Description :',
					'required' => true,
					'filters' => array('StringTrim'),
					'validators' => array(
							array('NotEmpty', true),
							array('StringLength', true, array('max'=>500))
					),
					'decorators' => $this->getElementDecorators(),
					'class' => 'pie'
			));
			$description->setAttrib('ROWS', '6');
			
			
			//Numéro de téléphone
			$tel = new Zend_Form_Element_Text('telephone', array(
					'label' => 'Téléphone : ',
					'required' => true,
					'filters' => array('StringTrim'),
					'decorators' => $this->getElementDecorators(),
					'class' => 'pie'
			));
				
			$TelephoneValidator = new Validator_Telephone();
			$tel->addValidator($TelephoneValidator, true);
			 
			 //Date 
			$date_besoin = new Zend_Form_Element_Text('date_besoin', array(
			'label' => 'Date : ',
			'required' => true,
            'filters' => array('StringTrim'),
            'decorators' => $this->getElementDecorators(),
			'class' => 'pie'
             ));
			
			$DateValidator = new Validator_Date();
			$date_besoin->addValidator($DateValidator, true);
			
			
			//Nombre de Personnes	
			$nbpersonne = new Zend_Form_Element_Select('nbpersonne', array(
                    'label' => 'Nb Personne :',
                    'required' => true,
                    'validators' => array('NotEmpty'),
					'filter' => 'Int',
                    'decorators' => $this->getElementDecorators(),
					'class' => 'pie'
                ));
			$nbpersonne->addMultiOption('',"Veuillez choisir un nombre");
			$nbpersonne->addMultiOption(1,"1");
			$nbpersonne->addMultiOption(2,"2");
			$nbpersonne->addMultiOption(3,"3");
			$nbpersonne->addMultiOption(4,"4");
			$nbpersonne->addMultiOption(5,"5");
			$nbpersonne->addMultiOption(6,"6");
			$nbpersonne->addMultiOption(7,"7");
			$nbpersonne->addMultiOption(8,"8");
			$nbpersonne->addMultiOption(9,"9");
			$nbpersonne->addMultiOption(10,"10+");
				
				
			//Submit
			$valider = new Zend_Form_Element_Submit('valider', array(
                    'label' => 'Valider'
                ));
			$valider->setAttribs(array('class' => 'btn btn-large btn-block btn btn-inverse'));
			
			$this->addElements(array($nom,$description,$tel,$nbpersonne,$date_besoin, $valider));
    }

}
